<include file="public/layout" />
<link href="__PUBLIC__/static/css/tp-pc-decorate.css" rel="stylesheet"/>
<script>
    var gol='';   //全局变量 记录当前上传图片的节点对象
    var link='';  //全局变量 记录当前点击添加链接操作的节点对象
    var url_tmp=''; //全局变量 用来保存弹窗里选择的链接
    var url_type=''; //链接类型
    var item='1'; //橱窗模式下编辑操作的li元素序号 默认为1
    var tab_item=0; //商品列表选项卡序号
    var coupon_num=0;   //记录选择的优惠券数量
    var coupon_tmp=[];  //记录所选优惠券的数据
</script>
<body style="background-color: #FFF; overflow: auto;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
  <div class="fixed-bar">
    <div class="item-title"><a class="back" href="javascript:history.back();" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></a>
      <div class="subject">
        <h3>商品分类 - 添加修改分类</h3>
        <h5>添加或编辑商品分类</h5>
      </div>
    </div>
  </div>
  <div class="explanation" id="explanation">
    <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
      <h4 title="提示相关设置操作时应注意的要点">操作提示</h4>
      <span id="explanationZoom" title="收起提示"></span>
    </div>
    <ul>
      <li>商品分类最多分为三级</li>
      <li>添加或者修改分类时, 应注意选择对应的上级</li>
    </ul>
  </div>
  <form action="{:U('MiniPage/addEditCategory')}" method="post" class="form-horizontal" id="category_form">
    <div class="ncap-form-default">
      <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>分类名称</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="名称" class="input-txt" name="name" value="{$goods_category_info.name}">
          <span class="err" id="err_name" style="color:#F00; display:none;"></span>
          <p class="notic"></p>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>副标题</label>
        </dt>
        <dd class="opt">
          <input type="text" placeholder="手机分类名称" class="input-txt" name="mobile_name" value="{$goods_category_info.mobile_name}">
          <span class="err" id="err_mobile_name" style="color:#F00; display:none;"></span>
          <p class="notic"></p>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit" colspan="2">
          <label class="" for="s_sort">上级分类</label>
        </dt>
        <dd class="opt">
          <div id="gcategory">
            <select name="parent_id" id="parent_id" class="class-select valid">
                <option value="0">顶级分类</option>
				{$cat_select}                                         
            </select>                    
          </div>
          <p class="notic">如果选择上级分类，那么新增的分类则为被选择上级分类的子分类</p>
        </dd>
      </dl>
	  <dl class="row">
        <dt class="tit">
          <label for="t_mane"><em>*</em>是否显示</label>
        </dt>
        <dd class="opt">
          <div class="onoff">
            <label for="goods_category1" class="cb-enable <if condition="$goods_category_info[is_show] eq 1">selected</if>">是</label>
            <label for="goods_category0" class="cb-disable <if condition="$goods_category_info[is_show] eq 0">selected</if>">否</label>
            <input id="goods_category1" name="is_show" value="1" type="radio" <if condition="$goods_category_info[is_show] eq 1"> checked="checked"</if>>
            <input id="goods_category0" name="is_show" value="0" type="radio" <if condition="$goods_category_info[is_show] eq 0"> checked="checked"</if>>
          </div>
          <p class="notic">在小程序分类中是否显示</p>
        </dd>        
      </dl>    
      
	   <!--<dl class="row">-->
        <!--<dt class="tit" colspan="2">-->
          <!--<label class="" for="s_sort">分类分组</label>-->
        <!--</dt>-->
        <!--<dd class="opt">-->
          <!--<div>-->
              <!--<select name="cat_group" id="cat_group" class="form-control">-->
                <!--<option value="0">0</option>                                        -->
                <!--<option value='1' <if condition="$goods_category_info[cat_group] eq 1"> selected='selected'</if>>1</option>"-->
                <!--<option value='2' <if condition="$goods_category_info[cat_group] eq 2"> selected='selected'</if>>2</option>"-->
                <!--<option value='3' <if condition="$goods_category_info[cat_group] eq 3"> selected='selected'</if>>3</option>"-->
                <!--<option value='4' <if condition="$goods_category_info[cat_group] eq 4"> selected='selected'</if>>4</option>"-->
                <!--<option value='5' <if condition="$goods_category_info[cat_group] eq 5"> selected='selected'</if>>5</option>"-->
                <!--<option value='6' <if condition="$goods_category_info[cat_group] eq 6"> selected='selected'</if>>6</option>"-->
                <!--<option value='7' <if condition="$goods_category_info[cat_group] eq 7"> selected='selected'</if>>7</option>"-->
                <!--<option value='8' <if condition="$goods_category_info[cat_group] eq 8"> selected='selected'</if>>8</option>"-->
                <!--<option value='9' <if condition="$goods_category_info[cat_group] eq 9"> selected='selected'</if>>9</option>"-->
                <!--<option value='10' <if condition="$goods_category_info[cat_group] eq 10"> selected='selected'</if>>10</option>"-->
                <!--<option value='11' <if condition="$goods_category_info[cat_group] eq 11"> selected='selected'</if>>11</option>"-->
                <!--<option value='12' <if condition="$goods_category_info[cat_group] eq 12"> selected='selected'</if>>12</option>"-->
                <!--<option value='13' <if condition="$goods_category_info[cat_group] eq 13"> selected='selected'</if>>13</option>"-->
                <!--<option value='14' <if condition="$goods_category_info[cat_group] eq 14"> selected='selected'</if>>14</option>"-->
                <!--<option value='15' <if condition="$goods_category_info[cat_group] eq 15"> selected='selected'</if>>15</option>"-->
                <!--<option value='16' <if condition="$goods_category_info[cat_group] eq 16"> selected='selected'</if>>16</option>"-->
                <!--<option value='17' <if condition="$goods_category_info[cat_group] eq 17"> selected='selected'</if>>17</option>"-->
                <!--<option value='18' <if condition="$goods_category_info[cat_group] eq 18"> selected='selected'</if>>18</option>"-->
                <!--<option value='19' <if condition="$goods_category_info[cat_group] eq 19"> selected='selected'</if>>19</option>"-->
                <!--<option value='20' <if condition="$goods_category_info[cat_group] eq 20"> selected='selected'</if>>20</option>"-->
              <!--</select>                             -->
          <!--</div>-->
          <!--<p class="notic">有时候左侧菜单栏同一行显示多个分类, 所以给他们一个分组</p>-->
        <!--</dd>-->
      <!--</dl>-->

      <dl class="row">
        <dt class="tit">
          <label>分类展示图片</label>
        </dt>
        <dd class="opt">
          <div class="input-file-show">
            <span class="show">
                <a id="img_a" target="_blank" class="nyroModal" rel="gal" href="{$goods_category_info.image}">
                  <i id="img_i" class="fa fa-picture-o" onmouseover="layer.tips('<img src={$goods_category_info.image}>',this,{tips: [1, '#fff']});" onmouseout="layer.closeAll();"></i>
                </a>
            </span>
            <span class="type-file-box">
                <input type="text" id="image" name="image" value="{$goods_category_info.image}" class="type-file-text">
                <input type="button" name="button" id="button1" value="选择上传..." class="type-file-button">
                <input class="type-file-file" onClick="GetUploadify(1,'','category','img_call_back')" size="30" hidefocus="true" nc_type="change_site_logo" title="点击前方预览图可查看大图，点击按钮选择文件并提交表单后上传生效">
            </span>
          </div>
          <span class="err"></span>
          <p class="notic">请上传图片格式文件</p>
        </dd>
      </dl>
      <dl class="row">
        <dt class="tit">
          <label for="t_sort"><em>*</em>排序</label>
        </dt>
        <dd class="opt">
          <input type="text" class="t_mane" name="sort_order" id="t_sort" value="{$goods_category_info.sort_order}">
          <span class="err" style="color:#F00; display:none;" id="err_sort_order"></span>
          <p class="notic">根据排序进行由小到大排列显示。</p>
        </dd>
      </dl>
	  <!--<dl class="row">-->
        <!--<dt class="tit">-->
          <!--<label for="t_sort"><em>*</em>分佣比例</label>-->
        <!--</dt>-->
        <!--<dd class="opt">-->
          <!--<input type="text" class="t_mane" name="commission_rate" value="{$goods_category_info.commission_rate}">%-->
          <!--<span class="err" style="color:#F00; display:none;" id="err_commission_rate"></span>-->
          <!--<p class="notic">用于商城分销,微信三级分销。</p>-->
        <!--</dd>-->
      <!--</dl>                         -->
      <dl class="row">
        <dt class="tit">
        <label for="t_sort"><em>*</em>选择目标</label>
        </dt>
        <dd class="opt">
          <div class="tpd-addlink-target">
            <i></i>
            {$goods_category_info.url=='' ? '添加链接目标':$goods_category_info.url}
          </div>
          <input type="hidden" class="t_mane btn" name="url" id="t_url" value="{$goods_category_info.url}">
          <span class="err" style="color:#F00; display:none;" id="err_sort_url"></span>
          <p class="notic">小程序点击后会跳转对应的位置。</p>
        </dd>
      </dl>
      <div class="bot"><a id="submitBtn" class="ncap-btn-big ncap-btn-green" href="JavaScript:void(0);" onClick="ajax_submit_form('category_form','{:U('MiniPage/addEditCategory?is_ajax=1')}');">确认提交</a></div>
    </div>
    <input type="hidden" name="id" value="{$goods_category_info.id}">
  </form>
</div>


<div class="pop-warp pop-link" id="pop-link" style="display:none">
  <div class="pop-title">选择链接</div>
  <a class="close-pop-btn" href="javascript:;"></a>
  <div class="pop-menu pop-link-menu">
    <a class="link-menu-ac" href="javascript:;">文章列表</a>
    <a href="javascript:;">文章分类</a>
    <a href="javascript:;">商品分类</a>
    <a href="javascript:;">商品详情</a>
    <!--<a href="javascript:;">自定义页面</a>-->
  </div>
  <ul class="pop-link-list">
    <li class="pop-link-ac">
      <form class="pop-search pop-goods-search">
        <input type="text" id="article_keywords" placeholder="搜索文章名称"/>
        <input type="hidden" id="art_search_history" value="{$artKeywords}"/>
        <a id="article_search" href="javascript:;"></a>
      </form>
      <ul class="pop-goods-detail">
        <li class="p-li0"><input type="checkbox" value=" "/></li>
        <li class="p-li1">文章编码</li>
        <li class="p-li2">标题</li>
        <li class="p-li3">显示图片</li>
        <li class="p-li4">文章分类</li>
      </ul>
      <div class="pop-goods-detail a-goods-list">
        <div class="p-goods-scroll">

          <volist name="ArticleList" id="vo">
            <ul class="p-goods-item">
              <li class="pi-li0"><input type="checkbox" value="{$vo.article_id}"/></li>
              <li class="pi-li1">{$vo.article_id}</li>
              <li class="pi-li2">{$vo.title}</li>
              <li class="pi-li3"><img src="{$vo.thumb}" alt=""/></li>
              <li class="pi-li4">{$art_cat_list[$vo.cat_id]}</li>
            </ul>
          </volist>
        </div>
      </div>
      <div class="pop-goods-paging">
        <span><i id="art-page">1</i>/<i id="art-count">{$count2}</i></span>
        <a onclick="art_page_show(1);" href="javascript:;">&gt;</a>
        <a onclick="art_page_show(0);" href="javascript:;">&lt;</a>
      </div>
    </li>
    <li>
      <ul class="pop-goods-detail" style="margin-top: 10px">
        <li class="p-li0"><input type="checkbox" value=" "/></li>
        <li class="p-li2">分类标题</li>
      </ul>
      <div class="pop-goods-detail c-goods-list">
        <div class="p-goods-scroll">
          <foreach name="art1_cat_list" item="vo" key="k">
            <ul class="p-goods-item">
              <li class="pi-li0"><input type="checkbox" value="{$vo.cat_id}"/></li>
              <li class="pi-li1" style="padding-left:<?php echo ($vo[level] * 4); ?>em"">{$vo.name}/{$vo.cat_desc}</li>
            </ul>
          </foreach>
        </div>
      </div>

    </li>
    <li>
      <div class="pop-link-goodscategory clearfix">
        <div class="tpd-cstyle-select tpd-cdiy-font28">
          <label>一级分类 : </label>
          <div>
            <select name="cat_id" id="cat_id" class="small form-control">
              <option value="0">请选择商品分类</option>
              <foreach name="cat_list" item="v" key="k">
                <option value="{$v['id']}"
                <if condition="$v['id'] eq $level_cat['1']">selected="selected"</if>
                >
                {$v['name']}
                </option>
              </foreach>
            </select>
          </div>
        </div>
        <div class="tpd-cstyle-select tpd-cdiy-font28">
          <label>二级分类 : </label>
          <div>
            <select name="cat_id_2" id="cat_id_2" onChange="get_class_2(this);" class="small form-control">
              <option value="0">请选择商品分类</option>
            </select>
          </div>
        </div>
        <div class="tpd-cstyle-select tpd-cdiy-font28">
          <label>三级分类 : </label>
          <div>
            <select name="cat_id_3" id="cat_id_3" onchange="goods_class();" class="small form-control">
              <option value="0">请选择商品分类</option>
            </select>
          </div>
        </div>
      </div>
      <style type="text/css">
        .pop-link-goodscategory {
          min-height: 100px;
        }

        .pop-links-des {
          width: 700px;
          margin: 0 auto;
          font-size: 18px;
          color: #666;
          padding: 10px;
          border: 1px solid #ccc;
          line-height: 24px;
        }
        .c-goods-list {
          margin-top: -1px;
          height: 200px;
          overflow-y: auto;
        }
      </style>
      <div class="pop-links-des" id="url_show"></div>
      <script>
          //get_category(this.value,'cat_id_3','0');
          /*【弹窗-商品分类】下拉列表*/
          $('.pop-link-goodscategory').find('.tpd-select-wrap').click(function (e) {
              $(this).toggleClass('tpd-select-ac');
              var target = $(e.target);
              if (target.is($(this).find('li'))) {
                  $(this).find('span').html(target.text());
              }
          });
      </script>
    </li>
    <li>
      <form class="pop-search pop-goods-search">
        <input type="text" id="goods_keywords" placeholder="搜索商品名称"/>
        <input type="hidden" id="search_history" value="{$keywords}"/>
        <a id="goods_search" href="javascript:;"></a>
      </form>
      <ul class="pop-goods-detail">
        <li class="p-li0"><input type="checkbox" value=" "/></li>
        <li class="p-li1">商品编码</li>
        <li class="p-li2">商品名称</li>
        <li class="p-li3">商品图片</li>
        <li class="p-li4">商品分类</li>
        <li class="p-li4">商品价格</li>
        <li class="p-li4">商品库存</li>
      </ul>
      <div class="pop-goods-detail p-goods-list">
        <div class="p-goods-scroll">

          <volist name="goodsList" id="vo">
            <ul class="p-goods-item">
              <li class="pi-li0"><input type="checkbox" value="{$vo.goods_id}"/></li>
              <li class="pi-li1">{$vo.goods_id}</li>
              <li class="pi-li2">{$vo.goods_name}</li>
              <li class="pi-li3"><img src="{$vo.original_img}" alt=""/></li>
              <li class="pi-li4">{$categoryList[$vo.cat_id]}</li>
              <li class="pi-li4">{$vo.shop_price}</li>
              <li class="pi-li4">{$vo.store_count}</li>
            </ul>
          </volist>
        </div>
      </div>
      <div class="pop-goods-paging">
        <span><i id="page">1</i>/<i id="count">{$count}</i></span>
        <a onclick="page_show(1);" href="javascript:;">&gt;</a>
        <a onclick="page_show(0);" href="javascript:;">&lt;</a>
      </div>
    </li>
    <li>
      <dl class="pop-link-mall pop-clink-wrap tpd-cdiy-font28">
        <dt>选择页面：</dt>
        <volist name="page_list" id="vo">
          <dd><label><input template-id="{$vo.id}" class="diyPage" type="radio" name="link-target5"/>{$vo.template_name}</label>
          </dd>
        </volist>
      </dl>
    </li>
  </ul>
  <div class="pop-link-btns">
    <a href="javascript:;" id="link-cancel">取消</a>
    <a href="javascript:;" id="link-ok">确定</a>
  </div>
  <script>
      function popLink() {
          $('.pop-link-menu>a').click(function () {  //切换列表
              $(this).addClass('link-menu-ac').siblings().removeClass('link-menu-ac');
              $('.pop-link-list>li').eq($(this).index()).addClass('pop-link-ac').siblings().removeClass('pop-link-ac');
              url_type = $(this).index();
          });
          var closeBtn = $('.pop-link>.close-pop-btn');
          closeBtn.click(function () {  //关闭弹窗
              $('#shade-module').fadeOut();
              $('#pop-link').slideUp();
          })
          $('#link-cancel').click(function () {  //取消
//            do something...
              closeBtn.trigger('click');
          })
          $('#link-ok').click(function () {  //弹窗选择链接确定
              //各个板块内的添加链接按钮 弹窗内设置完链接之后 添加链接按钮的输入框实时显示
              $('.tpd-addlink-target').html('<i></i>'+url_tmp);

              $('#t_url').val(url_tmp);

              closeBtn.trigger('click');
          })
      }
      popLink();

      //手动输入链接时
      $('#url1').blur(function () {
          url_tmp = 'http://' + $('#url1').val();
      });
      $('#url0').click(function () {
          url_tmp = '';
      });

      //选择商城页面时
      $('#shop_link').find('input').click(function () {
          url_tmp = $(this).val();
      })

      //选择自定义页面时
      $('.diyPage').click(function () {
          var tid = $(this).attr('template-id');
          url_tmp = '/mobile/index/index2/' + tid;
      });


      $(".p-goods-list").on('click', 'input', function () {
          if ($(this).prop('checked') == 'checked') {
              $(this).removeAttr('checked');
          } else {
              $(this).prop('checked', 'checked');
              //弹窗选择商品详情作链接
              url_tmp = '/index.php?m=Mobile&c=Goods&a=goodsInfo&id=' + $(this).val();
              $(this).parents('.p-goods-item').siblings().find('input').removeAttr('checked');   //可强制设为单选
          }
      });

      $(".a-goods-list").on('click', 'input', function () {
          if ($(this).prop('checked') == 'checked') {
              $(this).removeAttr('checked');
              console.log('1111');
          } else {

              console.log('222');
              $(this).prop('checked', 'checked');
              //弹窗选择商品详情作链接
              url_tmp = '/index.php?m=Mobile&c=Article&a=articleInfo&id=' + $(this).val();
              $(this).parents('.p-goods-item').siblings().find('input').removeAttr('checked');   //可强制设为单选
          }
      });

      $(".c-goods-list").on('click', 'input', function () {
          if ($(this).prop('checked') == 'checked') {
              $(this).removeAttr('checked');
          } else {
              $(this).prop('checked', 'checked');
              //弹窗选择商品详情作链接
              url_tmp = '/index.php?m=Mobile&c=Article&a=articleCat&id=' + $(this).val();
              $(this).parents('.p-goods-item').siblings().find('input').removeAttr('checked');   //可强制设为单选
          }
      });

      function get_class_2(a) {
          var tmp = "/index.php?m=Mobile&c=Goods&a=goodsList";
          tmp += "&id=" + $(a).val();
          url_tmp = tmp;
          $('#url_show').html(url_tmp);

          get_category($(a).val(), 'cat_id_3', '0');
      }


      function goods_class() {
          var tmp = "/index.php?m=Mobile&c=Goods&a=goodsList";
          tmp += "&id=" + $('#cat_id_3').val();
          url_tmp = tmp;
          $('#url_show').html(url_tmp);
      }


      $('#goods_search').click(function () {
          var keywords = $('#goods_keywords').val();
          ajax_goods_list(keywords, 1);
          $('#search_history').val(keywords);
          $('#page').html(1);
      })

      $('#article_search').click(function () {
          var keywords = $('#article_keywords').val();
          ajax_article_list(keywords, 1);
          $('#art_search_history').val(keywords);
          $('#art-page').html(1);
      })

      function page_show(status) {
          var page = parseInt($('#page').html());
          if (status == 0) {
              page = page - 1;
              if (page < 1) {
                  page = 1;
                  return;
              }
          }
          if (status == 1) {
              page = page + 1;
              if (page > parseInt($('#count').html())) {
                  page = parseInt($('#count').html());
                  return;
              }
          }
          $('#page').html(page);
          var keywords = $('#search_history').val();
          ajax_goods_list(keywords, page);
      }

      function art_page_show(status) {
          var page = parseInt($('#art-page').html());
          if (status == 0) {
              page = page - 1;
              if (page < 1) {
                  page = 1;
                  return;
              }
          }
          if (status == 1) {
              page = page + 1;
              if (page > parseInt($('#art-count').html())) {
                  page = parseInt($('#art-count').html());
                  return;
              }
          }
          $('#art-page').html(page);
          var keywords = $('#art_search_history').val();
          ajax_article_list(keywords, page);
      }

      function ajax_goods_list(keywords, page) {
          $.ajax({
              type: "POST",
              url: "/index.php?m=Admin&c=MiniPage&a=ajaxGoodsList&p=" + page,
              data: {'keywords': keywords, 'page': page},
              dataType: 'json',
              success: function (res) {
                  var r = res.result;
                  if (r.html) {
                      $('.pop-goods-detail.p-goods-list').html(r.html);
                  }
                  if (r.count) {
                      $('#count').html(r.count);
                  }
              }
          });
      }

      function ajax_article_list(keywords, page) {
          $.ajax({
              type: "POST",
              url: "/index.php?m=Admin&c=MiniPage&a=ajaxArticleList&p=" + page,
              data: {'keywords': keywords, 'page': page},
              dataType: 'json',
              success: function (res) {
                  var r = res.result;
                  if (r.html) {
                      $('.pop-goods-detail.a-goods-list').html(r.html);
                  }
                  if (r.count) {
                      $('#art-count').html(r.count);
                  }
              }
          });
      }

  </script>

  <script>
      //选择分类
      $(function () {
          $(document).on("change", '#cat_id', function () {
              get_category($(this).val(), 'cat_id_2', '0');

              var tmp = "/index.php?m=Mobile&c=Goods&a=goodsList";
              tmp += "&id=" + $(this).val();
              url_tmp = tmp;
              $('#url_show').html(url_tmp);

              $('#cat_id_3').empty().html("<option value='0'>请选择商品分类</option>");
          })
      })
      $(function () {
          $(document).on("change", '#extend_cat_id', function () {
              get_category($(this).val(), 'extend_cat_id_2', '0');

              var tmp = "{:U('Mobile/Goods/goodsList')}";
              tmp += "/id/" + $(this).val() + ".html";
              url_tmp = tmp;
              $('#url_show').html(url_tmp);

              $('#extend_cat_id_3').empty().html("<option value='0'>请选择商品分类</option>");
          })
      })
      $(function () {
          $(document).on("click", '.is_virtual', function () {
              initIsVirtual();
          })
      })

      /** 以下是编辑时默认选中某个商品分类*/
      $(document).ready(function () {

          <if condition = "$level_cat['2'] gt 0" >
              // 商品分类第二个下拉菜单
              get_category('{$level_cat[1]}', 'cat_id_2', '{$level_cat[2]}');
          </if>
          <if condition = "$level_cat['3'] gt 0" >
              // 商品分类第二个下拉菜单
              get_category('{$level_cat[2]}', 'cat_id_3', '{$level_cat[3]}');
          </if>

          //  扩展分类
          <if condition = "$level_cat2['2'] gt 0" >
              // 商品分类第二个下拉菜单
              get_category('{$level_cat2[1]}', 'extend_cat_id_2', '{$level_cat2[2]}');
          </if>
          <if condition = "$level_cat2['3'] gt 0" >
              // 商品分类第二个下拉菜单
              get_category('{$level_cat2[2]}', 'extend_cat_id_3', '{$level_cat2[3]}');
          </if>

      });
  </script>
</div>


<script>  
    
/** 以下是编辑时默认选中某个商品分类*/
$(document).ready(function(){
    $("body").on('click','.tpd-addlink-target',function(){
        link=$(this);
        $('#pop-link').slideToggle('slow');
    })


});
 
// 将品牌滚动条里面的 对应分类移动到 最上面
//javascript:document.getElementById('category_id_3').scrollIntoView();
var typeScroll = 0;
function spec_scroll(o){
	var id = $(o).val();	
	//if(!$('#type_id_'+id).is('dt')){
		//return false;
	//} 	 
	$('#ajax_brandList').scrollTop(-typeScroll);
	var sp_top = $('#type_id_'+id).offset().top; // 标题自身往上的 top
	var div_top = $('#ajax_brandList').offset().top; // div 自身往上的top
	$('#ajax_brandList').scrollTop(sp_top-div_top); // div 移动
	typeScroll = sp_top-div_top;
}

function img_call_back(fileurl_tmp)
{
  $("#image").val(fileurl_tmp);
  $("#img_a").attr('href', fileurl_tmp);
  $("#img_i").attr('onmouseover', "layer.tips('<img src="+fileurl_tmp+">',this,{tips: [1, '#fff']});");
}
</script>
</body>
</html>